<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>后台管理系统</title>
<meta name="description" content="这是一个 index 页面">
<meta name="keywords" content="index">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="/yanglinlin/Public/assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed" href="/yanglinlin/Public/assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="stylesheet" href="/yanglinlin/Public/assets/css/amazeui.min.css"/>
<link rel="stylesheet" href="/yanglinlin/Public/assets/css/admin.css">
<link rel="stylesheet" type="text/css" href="/yanglinlin/Public/style/style.css">
<script src="/yanglinlin/Public/assets/js/jquery.min.js"></script>
<script src="/yanglinlin/Public/assets/js/app.js"></script>
</head>
<body>
<!--[if lte IE 9]><p class="browsehappy">升级你的浏览器吧！ <a href="http://se.360.cn/" target="_blank">升级浏览器</a>以获得更好的体验！</p><![endif]-->
</head>

<body>
<header class="am-topbar admin-header" style="height:100px;padding-top:15px;background:#f5faf5;">
  <div class="am-topbar-brand" style="padding-left:70px;"><img src="/yanglinlin/Public/assets/i/logo.png"></div>

  <div class="header-top"> <p>欢迎系统管理员： <span>admin</span></p>
<a href="<?php echo U('Index/index');?>">系统首页</a>
  <a href="<?php echo U('Home/Index/index');?>" target="_blank">网站首页</a> <a href="<?php echo U('Index/logout');?>">退出</a></div>
</header>

<div class="am-cf admin-main"> 

<div class="nav-navicon admin-main admin-sidebar">
    <div class="sideMenu">
      <h3 class="am-icon-flag <?php if(in_array(CONTROLLER_NAME,array('Cate','Article','Recycle'))): ?>on<?php endif; ?>"><em></em> <a href="#">文章管理</a></h3>
      <ul>
        <li><a href="<?php echo U('Cate/index');?>">栏目管理</a></li>
        <li><a href="<?php echo U('Article/add');?>">添加文章</a></li>
        <li><a href="<?php echo U('Article/index');?>">文章管理</a></li>
        <li><a href="<?php echo U('Recycle/index');?>">	回收站管理</a></li>
      </ul>
      <h3 class="am-icon-cart-plus <?php if(CONTROLLER_NAME == Pict || CONTROLLER_NAME == PictCate): ?>on<?php endif; ?>"><em></em> <a href="#"> 图片管理</a></h3>
      <ul>
        <li><a href="<?php echo U('PictCate/index');?>">图片分类</a></li>
        <li><a href="<?php echo U('Pict/add');?>">图片添加</a></li>
        <li><a href="<?php echo U('Pict/index');?>">图片管理</a></li>
      </ul>
      <h3 class="am-icon-users <?php if(CONTROLLER_NAME == Msg): ?>on<?php endif; ?>"><em></em> <a href="#">在线留言</a></h3>
      <ul>
        <li><a href="<?php echo U('Msg/index');?>">在线留言</a> </li>
      </ul>
      <h3 class="am-icon-gears <?php if(in_array(CONTROLLER_NAME,array('Config','Link','Admin','AuthGroup','AuthRule'))): ?>on<?php endif; ?>"><em></em> <a href="#">系统设置</a></h3>
      <ul>
        <li><a href="<?php echo U('Config/index');?>">系统设置</a></li>
        <li><a href="<?php echo U('Link/index');?>">友情链接</a></li>
        <!-- <li><a href="<?php echo U('Admin/index');?>">管理员管理</a></li>
        <li><a href="<?php echo U('AuthGroup/index');?>">角色管理</a></li>
        <li><a href="<?php echo U('AuthRule/index');?>">权限管理</a></li> -->
      </ul>
      <h3 class="am-icon-volume-up"><em></em> <a href="#">网站信息</a></h3>
      <ul>
        <li><a href="<?php echo U('Home/Index/index');?>">网站首页</a></li>
      </ul>
    </div>
    <!-- sideMenu End --> 
    
    <script type="text/javascript">
			jQuery(".sideMenu").slide({
				titCell:"h3", //鼠标触发对象
				targetCell:"ul", //与titCell一一对应，第n个titCell控制第n个targetCell的显示隐藏
				effect:"slideDown", //targetCell下拉效果
				delayTime:300 , //效果时间
				triggerTime:150, //鼠标延迟触发时间（默认150）
				defaultPlay:true,//默认是否执行效果（默认true）
				returnDefault:true //鼠标从.sideMen移走后返回默认状态（默认false）
				});
		</script> 
</div>
<div class=" admin-content">
<div class="admin-biaogelist">
	
    <div class="listbiaoti am-cf">
      <ul class="am-icon-flag on"> 栏目管理</ul>
      
      <dl class="am-icon-home" style="float: right;"> 当前位置： <a href="<?php echo U('Index/index');?>">首页</a> > 栏目管理</dl>
      
      <dl>
        <a href="<?php echo U('add');?>" class="am-btn am-btn-danger am-round am-btn-xs am-icon-plus"> 添加一级栏目</a>
      </dl>
    </div>
    <form class="am-form am-g">
          <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
            <thead>
              <tr class="am-success">
                <th class="table-id">id</th>
                <th class="table-id">排序</th>
                <th class="table-type">栏目名称</th>
                <th class="table-type">栏目类型</th>
                <th class="table-type">英文标识</th>
                <th width="163px" class="table-set">操作</th>
              </tr>
            </thead>
            <tbody>
            <?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="cate" level="<?php echo ($vo["level"]); ?>">
                <td><?php echo ($vo["id"]); ?></td>
                <td><?php echo ($vo["sort"]); ?></td>
                <td><?php if($vo['level'] != 0): ?>└<?php endif; echo str_repeat('─',2*$vo['level']);?><span class="contro" style="display: inline-block;border: 1px solid #000;line-height: 5px;height: 11px;width: 12px;text-align: center;cursor: pointer;">+</span><?php echo ($vo["name"]); ?></td>
                <td><?php echo ($vo["type"]); ?></td>
                <td><?php echo ($vo["en_name"]); ?></td>
                <td>
                  <div class="am-btn-toolbar">
                    <a href="<?php echo U('add',array('id'=>$vo['id']));?>">添加子目录</a>
                    <a href="<?php echo U('edit',array('id'=>$vo['id']));?>">编辑</a>
                    <a href="javascript:void(0);" onclick="del(<?php echo ($vo['id']); ?>)">删除</a>
                  </div>
                </td>
              </tr><?php endforeach; endif; else: echo "" ;endif; ?>
              
            </tbody>
          </table>
        </form>
<script>
function del(id){
    if(!confirm('确定要删除吗？')){
      return false;
    }
    $.ajax({
      url : "<?php echo U('del');?>",
      data : {'id':id},
      type : 'post',
      dataType : 'json',
      success : function(res){
        if(res.status == 'OK'){
          alert(res.msg);
          location = "/yanglinlin/Systemht/Cate/index.html";
        }
        else if(res.status == 'NO'){
          alert(res.msg);
        }
      }
    });
  }

  //子栏目现实隐藏
  var tr = $('.cate');
  var span = $('.contro');
  tr.each(function(i){
    //如果不是一级栏目就隐藏
    if($(this).attr('level') != 0){
      $(this).hide();
    }
    //如果没有子栏目，就不显示展开按钮
    if($(this).next().attr('level') <= $(this).attr('level') || $(this).next().attr('level') == null){
      $(this).find('span').hide();
    }
  })

  span.on('click',function(){
    var level = $(this).parents('tr').attr('level');
    var child_tr = $(this).parents('tr').nextAll();
    if($(this).html() == "+"){
      $(this).html('-');
      level++;
      child_tr.each(function(i){
        if($(this).attr('level') < level){
          return false;
        }
        if($(this).attr('level')  == level){
          $(this).show();
        }
      });
    }
    else{
      $(this).html('+');
      child_tr.each(function(i){
        if($(this).attr('level') <= level){
          return false;
        }
        $(this).hide();
        $(this).find('span').html('+');
      });
    }
  })
</script>

</div>

</div>




</div>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="/yanglinlin/Public/assets/js/polyfill/rem.min.js"></script>
<script src="/yanglinlin/Public/assets/js/polyfill/respond.min.js"></script>
<script src="/yanglinlin/Public/assets/js/amazeui.legacy.js"></script>
<![endif]--> 

<!--[if (gte IE 9)|!(IE)]><!--> 
<script src="/yanglinlin/Public/assets/js/amazeui.min.js"></script>
<!--<![endif]-->



</body>
</html>